【Xcode】 Applyed UIButton UIButtonステップアップ

2021年10月27日

Overview(概要)

Summary of ways to display UIButton.

UIButtonの表示方法のまとめ。


Conditions(前提)

MacOS: 11.5.2 (Big Sur)

Xcode: 13.0

Swift: 5.5


Generate Button(Button生成)

Declare and initialize a UIButton below.

var testButton = UIButton()

まず、上記コードでボタンを宣言&生成。


Button title

Some people might think he can set title by substituting a new Label for testButton.titleLabel.

But, it's not consice.

testButton.setTitle("", for .normal)

LabelをButton title に代入することではタイトルは変わりません。

上記コードの””部分に任意のStringを代入することで、タイトルを設定できます。



無料でホームページを作成しよう! このサイトはWebnodeで作成されました。 あなたも無料で自分で作成してみませんか? さあ、はじめよう